<!DOCTYPE html>
<html lang="ch-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 后代选择器 */
        div p {
            color: blue;
        }

        .nav p {
            color: red;
        }

        /* 子选择器 */
        ul li {
            color: red;
        }

        ul>p {
            color: blue;
        }

        p {
            color: green;
        }

        a {
            color: red;
            text-decoration: none;
            height: 300px;
            width: 300px;
            display: block;
            background-color: green;
            line-height: 300px;
        }

        a:hover {
            color: blue;
        }
    </style>
</head>

<body>
    <div class="nav">
        <p>nihao</p>
    </div>
    <ul>
        <p>o</p>
        <li>o</li>
        <li>
            <p>o</p>
        </li>
    </ul>
    <div>
        <a href="#">ni</a>
    </div>
</body>

</html>